#include<iostream>
#include<cmath>

class Point
{
    public:
    Point():x(0),y(0){}
    Point(int x,int y):x(x),y(y){}
    
    void show()
    {
        std::cout<<"("<<x<<","<<y<<")"<<std::endl;
    }

    //友元函数
    // 友元声明
    // friend double length(const Point & p);
    
    // 友元类
    // 友元关系是单向的
    // 友元关系不可继承
    
    friend class Tool;
    
    
    private:
    
    int x;
    int y;

};

class Tool
{
    public:
    
    static double length(const Point & p)
    {
    return sqrt(p.x * p.x  + p.y * p.y);
    }

    
    static double distance(const Point&p1,const Point &p2)
    {
        int dx = p1.x - p2.x;
        int dy = p1.x - p2.x;
        return sqrt(dx*dx + dy*dy);
    }

};






int main()
{
    Point p1;
    Point p2(1,1);
    p1.show();
    p2.show();

    std::cout<<Tool::length(p2)<<std::endl;
    
    std::cout<<Tool::distance(p2,p1)<<std::endl;



    return 0;
}